package com.service.device;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.secondary.device.Device25ObdIpMonitorInfoMapper;
import com.model.domain.device.GetDevice25ObdIpMonitorInfoDO;
import com.model.pojo.device.Device25ObdIpMonitorInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;



/**
 * @Author: zql
 * @Description: 大田IP信息监控服务
 * @Data: 2023-12-04
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class Device25ObdIpMonitorInfoService {
    private final Device25ObdIpMonitorInfoMapper device25ObdIpMonitorInfoMapper;

    public List<Device25ObdIpMonitorInfo> getPageList(GetDevice25ObdIpMonitorInfoDO getDevice25ObdIpMonitorInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDevice25ObdIpMonitorInfoDO.getPage(),getDevice25ObdIpMonitorInfoDO.getPageSize(),getDevice25ObdIpMonitorInfoDO.getSortRow()+getDevice25ObdIpMonitorInfoDO.getSortOrder());
        return device25ObdIpMonitorInfoMapper.selectList(getDevice25ObdIpMonitorInfoDO);
    }
    public int update(Device25ObdIpMonitorInfo info){
        info.setLastModifiedTime(new Date());
        return device25ObdIpMonitorInfoMapper.updateByPrimaryKeySelective(info);
    }

    public Device25ObdIpMonitorInfo getById(Long id){
        return device25ObdIpMonitorInfoMapper.selectByPrimaryKey(id);
    }
}
